package com.qingjiang.projectschedule.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qingjiang.projectschedule.mapper.ConfigMapper;
import com.qingjiang.projectschedule.pojo.Config;
import com.qingjiang.projectschedule.service.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 16325
 * @description 针对表【config】的数据库操作Service实现
 * @createDate 2024-03-29 09:53:21
 */
@Service
public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config>
        implements ConfigService {

    @Autowired
    private ConfigMapper configMapper;

    public Integer getYellowDays() {
        LambdaQueryWrapper<Config> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Config::getDescription, "yellow_card");
        return configMapper.selectOne(queryWrapper).getDays();
    }

    @Override
    public Integer getMessageDays() {
        LambdaQueryWrapper<Config> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Config::getDescription, "message");
        return configMapper.selectOne(queryWrapper).getDays();
    }
}




